<?php
    include '../connectDatabase.php';

    $ID = $_POST['ID'];

    $sqlshow = "select * from users where user_id = '$ID'";
    $result = mysqli_query($conn,$sqlshow);
    $records = array();
    while($record = mysqli_fetch_array($result))
    {
        $records [] = $record;
    }

    if($records == null){
        echo "<script>alert('不存在此用户！');window.location.href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/Search_user.php'</script>";    
    }
    $close = @mysqli_close($conn);
?>

<!DOCTYPE html>
<html lang="zh-CN">
<style type="text/css">
    .title4 {
        color: #fafafa;

        letter-spacing: 0;

        font-size: 50px;

        text-shadow: 0px 1px 0px #999, 0px 2px 0px #888, 0px 3px 0px #777, 0px 4px 0px #666, 0px 5px 0px #555, 0px 6px 0px #444, 0px 7px 0px #333, 0px 8px 7px #001135;

    }
    .box {
        background-color: #FFF;
        border-radius: 5px;
        border: 1px solid #DDD;
        padding: 30px 20px;
        margin: 50px 10% 20px 10%;
        width: 80%;
        height: 400px;
        text-align: center;

    }

    .box:hover {
        box-shadow: 0 0 5px 3px #CCC;
    }
    .table11_7 table {
        width:100%;
        margin:15px 0;
        border:0;
    }
    .table11_7 th {
        background-color:#00A5FF;
        color:#FFFFFF
    }
    .table11_7,.table11_7 th,.table11_7 td {
        font-size:0.95em;
        text-align:center;
        padding:4px;
        border-collapse:collapse;
    }
    .table11_7 th,.table11_7 td {
        border: 1px solid #2087fe;
        border-width:1px 0 1px 0;
        border:2px inset #ffffff;
    }
    .table11_7 tr {
        border: 1px solid #ffffff;
    }
    .table11_7 tr:nth-child(odd){
        background-color:#aae1fe;
    }
    .table11_7 tr:nth-child(even){
        background-color:#ffffff;
    }
</style>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>后台显示新闻类别</title>

    <link rel="stylesheet" href="../../../Public/Css/index.css">
</head>

<body>


    <nav class="navbar">
        <div class="container navbar-content">
            <ul id="menu">
                <li>
                    <a href=""> 首页</a>
                </li>
                <li>
                    <a href=""> 排行</a>
                </li>
                <li>
                    <a href=""> 分类浏览</a>
                </li>
                <li>
                    <a href=""> 所有新闻</a>
                </li>
                <li>
                    <a href=""> 所有新闻</a>
                </li>
                
                <?php
                    session_start();
                    include_once("../is_login.php");
                    if(is_superadmin()){
                        echo "
                        <li>
                        <a href=''>管理功能</a>
                        <ul>
                        <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/add_admin.php' >添加管理员</a></li>
                        <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/look_user.php' >浏览用户</a></li>
                        <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/Search_user.php' >用户查询</a></li>
                        </ul>
                        </li>
                        ";
                    }
                    if(is_jadmin()){
                        echo "
                        <li>
                        <a href=''>管理功能</a>
                        <ul>
                        <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/look_user.php' >浏览用户</a></li>
                        <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/Search_user.php' >用户查询</a></li>
                        </ul>
                        </li>
                        ";
                    }

                    if(!is_login()){
                        
                        echo "<li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/login.php'> 登录</a></li>";
                    } else{
                        echo "<li><a href=''>个人信息</a>
                        <ul>
                            <li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/user_modify.php' >修改个人信息</a></li>
                        </ul>
                        </li>";
                        echo "<li><a href='http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/logout.php'> 注销</a></li>";
                    }
                ?>
        </div><!-- /.container-fluid -->
    </nav>


<h1 align="center" class="title4">&nbsp;&nbsp;&nbsp;新闻发布系统</h1>

    <div class="box">
<div class="sign-div">
    <form class="" action="../Action/login_action.php" method="post">
        <h1>用户信息</h1>
        <table border="10" width="100%" height="50" cellpadding=5 cellspacing="5" align="center">
    <tr>
        <td colspan="1">账号</td>
        <td colspan="1">用户名</td>
        <td colspan="1">性别</td>
        <td colspan="1">邮箱</td>
        <td align="center" colspan="2">操作</td>
    </tr>
    <?php foreach($records as $row) : ?>
    <tr>
        <td><?php echo $row['user_id'];?></td>
        <td><?php echo $row['user_name'];?></td>
        <td><?php echo $row['user_sex'];?></td>
        <td><?php echo $row['user_email'];?></td>
        <td colspan="1"><a href="../Page/admin_modify.php?code=<?php echo $row['user_id']?>">修改</td>
        <td colspan="1"><a href="../Action/delete_admin_action.php?code=<?php echo $row['user_id']?> ">删除</td>
    </tr>
    <?php endforeach;?>
    </table>
    <p align="left"><a href="http://localhost:8080/PHP-NEWS-RELEASE-SYSTEM/Application/User/Page/Search_user.php">点击返回搜索页面</a></p>
    </form>
</div>
    </div>
</body>
</html>